package com.rpj.stauy.config;

import com.rpj.stauy.service.PromptChatAssistent;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.service.AiServices;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PromptConfig {
    @Bean("chat")
    public ChatModel chatModel(){
        return OpenAiChatModel.builder()
                .apiKey(System.getenv("aliQwen_api"))
                .modelName("qwen-long")
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .build();
    }


    @Bean("massage")
    public PromptChatAssistent promptChatAssistent(ChatModel chatModel){
        return AiServices.create(PromptChatAssistent.class,chatModel);
    }
}
